package com.smit.livevideo.sample;

import android.app.Application;
import android.content.Intent;

import com.smit.icast.ICastInitializer;
import com.smit.livevideo.sample.activity.LiveVideoActivity;
import com.smit.livevideo.sample.db.SqliteBaseUtil;
import com.smit.utils.LogUtil;

/**
 * Created by smfang on 2015/11/24.
 * 应用的application，在这里会初始化iCast的so库、设备、鉴权等
 */
public class MyApplication extends Application
{
    private static final String TAG = MyApplication.class.getSimpleName();
    private static MyApplication instance;
    private static final String APP_ID = "10112016";
    private static final String APP_KEY = "5067da30977b2219";

    public static MyApplication getInstance()
    {
        return instance;
    }

    @Override
    public void onCreate()
    {
        super.onCreate();
        LogUtil.trace(TAG, "onCreate~~~");
        instance = this;
        ICastInitializer.getInstance().initializeICast(getApplicationContext(), APP_ID, APP_KEY);
        SqliteBaseUtil.init(getApplicationContext());
    }

    /**
     * 在这里可以启动LivevideoActivity
     */
    public void startLiveVideoActivity()
    {
        Intent intent = new Intent(getApplicationContext(), LiveVideoActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }
}
